$(document).ready(function() {
		/* Scroll event handler */
    
	$(window).bind('scroll',function(e){
    	parallaxScroll();
		
    });
	
	$(window).scroll(function () {
		//if (($(window).scrollTop() > 800) && (!$("#mycarousel img").hasClass("active"))){$("body").css("overflow","hidden")}
				
		});
});

/* Scroll the background layers */
function parallaxScroll(){
	var scrolled = $(window).scrollTop();
	var res=0;
	/*------------clouds------------------*/
	$('#parallax-bg1').css('top',(0-(scrolled*.75))+'px');
	$('#cl-1').css('left',(120+(scrolled*.7))+'px');
	$('#parallax-bg2').css('top',(0-(scrolled*.75))+'px');
	$('#cl-2').css('left',(-180-(scrolled*.65))+'px');
	$('#parallax-bg3').css('top',(0-(scrolled*.75))+'px');
	
	/*--------------------------elevator- ----------- ---*/
	$('#elevator').css('top',(500+(scrolled*.005))+'px');
	if(scrolled <18000){$('#elevator').css('display','block');}
	else{$('#elevator').css('display','none');}
	
	/*--------------------campbellfall-----------------*/
	res = scrolled/100;
	var mod = Math.floor(res%2);
	//$('#campbellfall').css('background-position',(-mod*344+'px 0px'));
	
	
	
	$('#campbellfall').html('<p>'+scrolled+'</p><p>'+res+'</p><p>'+mod+'</p>');
	if (scrolled>=500){
	$('#campbellfall').css('display','block');
	$('#campbellwrpap').css('top',(200+(scrolled*.005))+'px');}
			else {
	$('#campbellfall').css('display','none');
	}
	
	/*-----------Circle Rotator---Step4------*/ 
	$('#radius1').css({'-webkit-transform':'rotate('+(0+scrolled*0.65)+'deg)', '-moz-transform':'rotate('+(0+scrolled*0.65)+'deg)', '-ms-transform':'rotate('+(0+scrolled*0.65)+'deg)','-o-transform':'rotate('+(0+scrolled*0.65)+'deg)'});
	$('#radius2').css({'-webkit-transform':'rotate('+(0-scrolled*0.25)+'deg)', '-moz-transform':'rotate('+(0-scrolled*0.25)+'deg)', '-ms-transform':'rotate('+(0-scrolled*0.25)+'deg)','-o-transform':'rotate('+(0+scrolled*0.25)+'deg)'});
	$('#radius3').css({'-webkit-transform':'rotate('+(0+scrolled*0.35)+'deg)', '-moz-transform':'rotate('+(0+scrolled*0.35)+'deg)', '-ms-transform':'rotate('+(0+scrolled*0.35)+'deg)','-o-transform':'rotate('+(0+scrolled*0.35)+'deg)'});
	
	/*--------------BG Circle------*/
	$('.bgradius1').css({'-webkit-transform':'rotate('+(0+scrolled*0.65)+'deg)', '-moz-transform':'rotate('+(0+scrolled*0.65)+'deg)', '-ms-transform':'rotate('+(0+scrolled*0.65)+'deg)','-o-transform':'rotate('+(0+scrolled*0.65)+'deg)'});
	$('.bgradius2').css({'-webkit-transform':'rotate('+(0-scrolled*0.25)+'deg)', '-moz-transform':'rotate('+(0-scrolled*0.25)+'deg)', '-ms-transform':'rotate('+(0-scrolled*0.25)+'deg)','-o-transform':'rotate('+(0+scrolled*0.25)+'deg)'});
	$('.bgradius3').css({'-webkit-transform':'rotate('+(0+scrolled*0.35)+'deg)', '-moz-transform':'rotate('+(0+scrolled*0.35)+'deg)', '-ms-transform':'rotate('+(0+scrolled*0.35)+'deg)','-o-transform':'rotate('+(0+scrolled*0.35)+'deg)'});
		
	}
	
	function stopScroll(){
	$(window).scroll(function () {
	if (($(window).scrollTop() > 990) && (!$("#mycarousel img").hasClass("active"))){$("body").css("overflow","hidden")}
	//else if (($(window).scrollTop() > 1790) && ){$("body").css("overflow","hidden")}
	else {$("body").css("overflow","auto")}
	});
	}

